window.onload = function() {
  $(".productItem").each((i, v) => {
    let divHeight = $(v)
      .find(".img-wrapper")
      .height();
    let imgHeight = $(v)
      .find(".img-wrapper img")
      .height();
    if (divHeight > imgHeight) {
      $(v)
        .find(".img-wrapper img")
        .css({
          marginTop: (divHeight - imgHeight) / 2 + "px"
        });
    }else{
      this.console.log(divHeight-imgHeight)
    }
  });
};
